import friendsBlackSqlite from '@/sqlite_services/friendsBlack.js'
import $store from '@/store/index.js';
export default {
	/* 黑名单列表 */
	async blackList(query) {
		try{
			let res = await uni.$api.friendsBlack.list(query)
			if(res){
				return res.data
			}else{
				return false
			}
		}catch(e){
			throw e;
		}
	},
	/* 加入黑名单 */
	async black(frienId) {
		try{
			let res = await uni.$api.friendsBlack.black({friend_id:frienId})
			if(res){
				friendsBlackSqlite.addBlackInfo({
					black_id:frienId
				})
				uni.showToast({
					title:res.msg,
					icon:'none'
				})
				return res.data
			}else{
				return false
			}
		}catch(e){
			throw e;
		}
	},
	/* 移出黑名单 */
	async undock(frienId) {
		try{
			let res = await uni.$api.friendsBlack.undock({friend_id:frienId})
			if(res){
				friendsBlackSqlite.delBlackInfo(frienId)
				uni.showToast({
					title:res.msg,
					icon:'none'
				})
				return res.data
			}else{
				return false
			}
		}catch(e){
			throw e;
		}
	},
}